home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / attrPaintValues.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  5.5 KB  |  192 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. // Attribute Paint Tool UI script
  18. //
  19. global proc attrPaintValues(string $toolName)
  20. {
  21.     string $parent = (`toolPropertyWindow -q -location` + "|attrPaint");
  22.     setParent $parent;
  23.  
  24.     string $helpTag = "";
  25.     toolPropertySetCommon $toolName "attrPaint.xpm" $helpTag;
  26.  
  27.     string $currentTab = `tabLayout -query -selectTab attrPaintTabs_L`;
  28.     jasperValues( "attrPaintCtx", $toolName, $currentTab );
  29.  
  30.     toolPropertySelect attrPaint;
  31. }
  32.  
  33.  
  34. proc int canFind( string $sArray[], string $ref )
  35. {
  36.     for( $s in $sArray )
  37.     {
  38.         if( $s == $ref )
  39.         {
  40.             return true;
  41.         }
  42.     }
  43.     return false;
  44. }
  45.  
  46. global proc jasperAttrSelectValues(
  47.     string $jasperCommand, 
  48.     string $toolName,
  49.     string $currentTool,
  50.     int $force 
  51. )
  52. {
  53.     string $name;
  54.     string $DNbuffer[], $SDNbuffer[];
  55.     int    $DNsize, $SDNsize;
  56.  
  57.     // =========================================================
  58.     // get the list of paintable depend node name
  59.     // =========================================================
  60.     $cmd = ($jasperCommand + " -q -dns " + $toolName);
  61.     $DNsize = `eval $cmd`;
  62.     $cmd = ($jasperCommand + " -q -dnn " + $toolName);
  63.     $name = `eval $cmd`;
  64.     tokenize( $name, "|", $DNbuffer);
  65.  
  66.     // =========================================================
  67.     // get the list of selected paintable depend node name
  68.     // =========================================================
  69.     $cmd = ($jasperCommand + " -q -sds " + $toolName);
  70.     $SDNsize = `eval $cmd`;
  71.     $cmd = ($jasperCommand + " -q -sdn " + $toolName);
  72.     $name = `eval $cmd`;
  73.     tokenize( $name, "|", $SDNbuffer);
  74.  
  75.  
  76.     textScrollList -e -ra paintableDNList;
  77.      for( $s in $DNbuffer )
  78.      {
  79.         if( !canFind( $SDNbuffer, $s ) )
  80.         {
  81.             textScrollList -e -append $s paintableDNList;
  82.         }
  83.      }
  84.     textScrollList -e -w 165 paintableDNList;
  85.  
  86.  
  87.      textScrollList -e -ra paintSelectedObjList;
  88.      for( $i = 0; $i < $SDNsize; $i++ )
  89.      {
  90.          textScrollList -e -append $SDNbuffer[$i] paintSelectedObjList;
  91.      }
  92.     textScrollList -e -w 165 paintSelectedObjList;
  93.  
  94. }
  95.  
  96. global proc jasperAttrValues( 
  97.     string $jasperCommand, 
  98.     string $toolName,
  99.     string $currentTool,
  100.     int $force 
  101. )
  102. {
  103.     global string   $jasperObjExpanded[];
  104.     global int      $jasperObjExpandedSize;
  105.     global int      $jasperAttrTabMenuIndex;
  106.  
  107.     string $cmd;
  108.     global int $jasperAttrActive;
  109.  
  110.     if ( !$force && $jasperAttrActive ) {
  111.         return;
  112.     }
  113.     $jasperAttrActive = 1;
  114.  
  115.     // =========================================================
  116.     // get the list of paintable obj name
  117.     // =========================================================
  118.     string $buffer[];
  119.     $cmd = ($jasperCommand + " -q -ots " + $toolName);
  120.     int $size = `eval $cmd`;
  121.     $cmd = ($jasperCommand + " -q -otn " + $toolName);
  122.     string $name = `eval $cmd`;
  123.     tokenize( $name, "|", $buffer);
  124.  
  125.  
  126.     if( $size != $jasperObjExpandedSize )
  127.     {
  128.         jasperObjExpandedReset( $jasperCommand, $toolName, false );
  129.     }
  130.  
  131.     textScrollList -e -w 160 -ra paintableObjTypeList;
  132.     string $objName, $attrName;
  133.     for( $i = 0; $i < $size; $i++ )
  134.     {
  135.         if( $jasperObjExpanded[$i] == true )
  136.         {
  137.             // add object type name
  138.             $objName = ( " - " + $buffer[$i] );
  139.             textScrollList -e -w 160 -append $objName paintableObjTypeList;
  140.             
  141.             // add attr type name
  142.             $cmd = ($jasperCommand + " -e -oth " + $buffer[$i]+" "+$toolName);
  143.             eval $cmd;
  144.             $cmd = ($jasperCommand + " -q -ats " + $toolName);
  145.             int $attrSize = `eval $cmd`;
  146.             $cmd = ($jasperCommand + " -q -atn " + $toolName);
  147.             string $name2 = `eval $cmd`;
  148.             
  149.             string $buffer2[];
  150.             tokenize( $name2, "|", $buffer2);
  151.             for( $j = 0; $j < $attrSize; $j++ )
  152.             {
  153.                 // add object type name
  154.                 $attrName = ( "     " + $buffer2[$j] );
  155.                 textScrollList -e -w 160 -append $attrName paintableObjTypeList;
  156.             }
  157.         }
  158.         else
  159.         {
  160.             $objName = ( " + " + $buffer[$i] );
  161.             textScrollList -e -w 160 -append $objName paintableObjTypeList;
  162.         }
  163.     }
  164.     textScrollList -e -w 160 paintableObjTypeList;
  165.  
  166.  
  167.     // =========================================================
  168.     // the rest of the UI for selecting paintable obj type tab
  169.     // =========================================================
  170.     $cmd = ($jasperCommand + " -q -ath " + $toolName);
  171.     textField -e -text `eval $cmd` paintableAttrTypeName;
  172.  
  173.     $cmd = ($jasperCommand + " -q -saveAttrTypeHighlight " + $toolName);
  174.     checkBoxGrp -e -v1 `eval $cmd` saveAttrTypeName;
  175.     
  176.     $cmd = ($jasperCommand + " -q -dti " + $toolName);
  177.     int $typeIndex = `eval $cmd`;
  178.     if( ( $typeIndex > 0 ) && ( $typeIndex < 4 ) )
  179.     {
  180.         radioButtonGrp -e -sl $typeIndex indexRadioButton;
  181.     }
  182.     else
  183.     {
  184.         $cmd = ($jasperCommand + " -e -dti 1 " + $toolName);
  185.         eval $cmd;
  186.         radioButtonGrp -e -sl 1 indexRadioButton;
  187.     }
  188.  
  189.     jasperAttrSelectValues( $jasperCommand, $toolName, $currentTool, $force );
  190. }
  191.  
  192.